Skip to content

Conversation

@dinhlongviolin1
Copy link
Contributor

@dinhlongviolin1 dinhlongviolin1 commented Sep 11, 2025

Describe Your Changes

  • Add a origin header for localhost request -> solve ollama issue

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Add 'Origin' header for local provider requests in completion.ts and tauri.ts to fix CORS issues with Ollama.

  • Behavior:
    • Add 'Origin' header for requests to local providers (localhost/127.0.0.1) in sendCompletion() in completion.ts and fetchModelsFromProvider() in tauri.ts to avoid CORS issues.
  • Misc:

This description was created by Ellipsis for a13a69b. You can customize this summary. It will automatically update as commits are pushed.

@dinhlongviolin1 dinhlongviolin1 changed the title fix ollama error fix: error connecting to ollama (#6349) Sep 11, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to a13a69b in 1 minute and 56 seconds. Click for details.
  • Reviewed 35 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/lib/completion.ts:185
  • Draft comment:
    When both openrouter and local provider conditions apply, the local block’s defaultHeaders will override the openrouter headers. Consider merging the two header sets to retain all required headers.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While technically correct, this seems like an edge case that would rarely if ever occur in practice. Why would an openrouter provider be running on localhost? The code appears to be handling two distinct cases - openrouter (a remote service) and local providers. The likelihood of both conditions being true simultaneously is extremely low. Additionally, if it did happen, having the Origin header for local CORS handling is probably more important than the openrouter identification headers. I could be wrong about the likelihood - perhaps there are valid testing scenarios where openrouter needs to be proxied through localhost. The loss of identification headers could cause issues with the openrouter service. Even if someone was testing with openrouter through localhost, the Origin header for CORS would be essential for functionality, while the openrouter headers are just for identification. The current behavior prioritizes making it work over perfect header inclusion. While technically accurate, this comment points out an edge case that is unlikely to occur and where the current behavior is probably correct anyway. The comment should be removed.
2. web-app/src/services/providers/tauri.ts:146
  • Draft comment:
    The addition of the 'Origin' header for local providers is appropriate; note that similar logic exists in sendCompletion. Consider refactoring this duplication into a shared utility if more cases arise.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None

Workflow ID: wflow_12YS4LKmI0lIAnsD

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dinhlongviolin1 dinhlongviolin1 merged commit db52057 into dev Sep 11, 2025
22 checks passed
@dinhlongviolin1 dinhlongviolin1 deleted the bug/ollama-server branch September 11, 2025 11:38
@github-project-automation github-project-automation bot moved this to QA in Jan Sep 11, 2025
@github-actions github-actions bot added this to the v0.6.10 milestone Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

bug: can't connect to local ollama server

3 participants